import '@/model/reflect-metadata';

export default function Works() {
  return <h1 className="text-3xl font-bold underline">Hello Works!</h1>;
}

interface IEnglishReport {
  name: string;
  getSpeakSkillStatus(): string;
  getLevel(): string;
  setLevel(level: string);
}

class Programer implements IEnglishReport {
  name: string;
  level = "糟糕";
  constructor(name) {
    this.name = name;
  }

  getSpeakSkillStatus(): string {
    return "一般";
  }

  getLevel(): string {
    return this.level;
  }
  setLevel(level: string) {
    this.level = level;
  }
}

class EnglishStudent implements IEnglishReport {
  name: string;
  level = "优秀";

  constructor(name) {
    this.name = name;
  }
  getSpeakSkillStatus(): string {
    return "优秀";
  }

  getLevel(): string {
    return this.level;
  }
  setLevel(level: string) {
    this.level = level;
  }
}

function checkEnglishSkill(user: IEnglishReport) {
  if (user.getSpeakSkillStatus() === "一般") {
    console.log(`${user.name}：报告不合格`);
    return "报告不合格";
  }
  console.log(`${user.name}：报告合格`);
  return "报告合格";
}


// const p1 = new Programer("程序员");
// const e1 = new EnglishStudent("高材生");

// checkEnglishSkill(p1);
// checkEnglishSkill(e1);

// function train<T extends IEnglishReport>(user: T): T {
//   if (user.getLevel() === "糟糕") {
//     console.log(`${user.name}：培训成功`);
//     user.setLevel("优秀");
//   } else {
//     console.log(`${user.name}：无需培训`);
//   }
//   return user;
// }

// console.log(train(p1));
// console.log(train(e1));
